from scipy.stats import ttest_rel
import pandas as pd

x = [20.5, 18.8, 19.8, 20.9, 21.5, 19.5, 21.0, 21.2]
y = [17.7, 20.3, 20.0, 18.8, 19.0, 20.1, 20.0, 19.1]
# 配对样本t检验
print(ttest_rel(x, y))
"""
Ttest_relResult(statistic=1.8001958337730648, pvalue=0.1148515300576627)
结论: 因为p值=0.1149>0.05, 故接受原假设, 认为在70℃时的平均断裂强力与80℃时的平均断裂强力间无显著差别
"""